<?php
$this->breadcrumbs=array(
	'Quản lý người dùng',
);

?>
<script>
$(document).ready(function(){
	
	
	
	$('#search').keyup(function(){
		
		var data = $(this).val();
		//alert(data);
		$.ajax({
            url: 'SuggestPerson',
            type: 'POST',
            dataType: 'JSON',
            data: {term: data},
            success: function(result){
            //$('#price').html(result.data.gia);
            //alert(result[0].username);
            $('#table tr').each(function() {
				//alert($(this).index());
				$(this).hide();
				if($(this).index()==0)
				{
					$(this).show();
				}
				for(var i=0;i<result.length;i++)
			    if($(this).find(".username").html() == result[i].username)
			    {
					$(this).show();
				}  
			    
	 		});
         //   alert($('table#table tr td').length;
            }
    		});
		});
	
});
</script>


	<div class='m-paging' style="margin-bottom:20px;"> <?php $this->widget('MyPage', array('pages' => $pages,)) ;?></div>
<br>
<div class='full-screen'>
	<h1>Quản lý người dùng</h1>
	<div class="row">
<input type=text id=search />

</div><br/>
		<div class='main-content'>

			<table id=table width='100%'>
				<tr class='header-table'>
					<th class=header width='15%'>User</th>
					<th width='17%'>Họ tên</th>
					<th width='17%'>Email</th>
					<th width='14%'>Điện thoại</th>
					<th width='13%'>Trạng thái</th>
					<th width='11%'>Reset password</th>					
					<th width='13%'>Thao tác</th>
				</tr>

			<?php

			foreach ($users as $value){

				echo "<tr class='row-table'>";

				echo "<td class='username'>". $value->username. "</td>";

				echo "<td>".$value->hoten. "</td>";

				echo "<td>". $value->email. "</td>";

				echo "<td>". $value->dienthoai. "</td>";

				echo "<td>". UserUtils::getUserState($value). "</td>";

				echo "<td>". CHtml::link('Reset', array('user/resetpassword', 'id' => $value->id)). "</td>";

				echo "<td>". UserUtils:: getAdminAction($value)."</td>";

				echo "</tr>";

			}

			?>

			</table>

		</div>

</div>